package com.sky.wsp.license.conf;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.Arrays;

/**
 * @author wangshaopeng@talkweb.com.cn
 * @desccription 在此输入描述
 * @date 2024/6/24
 */
@Component
@ConfigurationProperties(prefix = "license")
@XmlRootElement
public class LicenseConfig {
    // 产品名、项目名
    private String product;
    // 版本号
    private String version;
    // 产品/项目描述
    private String description;
    // 证书主题、客户端公开名、本产品在客户端部署时使用的公开网站域名
    private String subject;
    // 证书颁发时间/生效时间，若未填写则取当前时间
    private String issuedTime;
    // 证书失效时间，不能早于颁发时间且不能早于当前时间
    private String expiryTime;
    // 客户端信息，domain name 客户端唯一判别名
    private DomainName domainName;
    // 校验信息，可配置多台服务器信息
    private CheckModel[] checkModels;

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getIssuedTime() {
        return issuedTime;
    }

    public void setIssuedTime(String issuedTime) {
        this.issuedTime = issuedTime;
    }

    public String getExpiryTime() {
        return expiryTime;
    }

    public void setExpiryTime(String expiryTime) {
        this.expiryTime = expiryTime;
    }

    public DomainName getDomainName() {
        return domainName;
    }

    public void setDomainName(DomainName domainName) {
        this.domainName = domainName;
    }

    public CheckModel[] getCheckModels() {
        return checkModels;
    }

    public void setCheckModels(CheckModel[] checkModels) {
        this.checkModels = checkModels;
    }

    @Override
    public String toString() {
        return "{" +
                "product:" + product + ',' +
                "version:" + version + ',' +
                "description:" + description + ',' +
                "subject:" + subject + ',' +
                "issuedTime:" + issuedTime + ',' +
                "expiryTime:" + expiryTime + ',' +
                "domainName:" + domainName + ',' +
                "checkModels:" + Arrays.toString(checkModels) +
                '}';
    }
}
